<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
        <title>{:C('SERVER_HOME_NAME')}</title>
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/login.css">
    </head>
    <body>
        <div class="login m50">
            <div class="login-box">
                <div class="title">修改密码</div>
                <div id="showerror"  <if condition="$info['status'] eq 100">  style="display:block"  </if>> <span style="color:red" >{$info['info']}</span></div>

                <form method="post" action="">
                    <div class="login-form"><input id="pwInput" class="formIpt" type="password" placeholder="新密码"></div>
                    <div class="login-form"><input id="qrInput" class="formIpt" type="password" placeholder="确认密码"></div>
                    <div class="login-form"><input id="verification" class="login-code" type="text" placeholder="验证码"><div class="code-img"><img src="{:U('Home/Login/yanzheng')}" onclick='this.src = this.src + "?" + Math.random();'/></div></div>
                    <div class="login-btn"><a href="javascript:void(0);" class="btnlogin">修&nbsp;改&nbsp;密&nbsp;码</a></div>
                </form>
            </div>
        </div>
    <include file="Public/ok" />
    <script src="__PUBLIC__/js/jquery-1.7.min.js"></script>
    <script src="__PUBLIC__/js/page.js"></script>
    <script type="text/javascript">
                    $(function () {
                        $(".btnlogin").click(function () {
                            if ($("#pwInput").val() == "") {
                                modelConfirm("密码不能为空", function () {
                                    //TODO:提交
                                });
                                return false;
                            } else if ($("#qrInput").val() == "") {
                                modelConfirm("确认密码不能为空", function () {
                                    //TODO:提交
                                });
                                return false;
                            } else if ($("#pwInput").val() != $("#qrInput").val()) {
                                modelConfirm("两次输入的密码不相同", function () {
                                    //TODO:提交
                                });
                                return false;
                            } else if ($("#verification").val() == "") {
                                modelConfirm("验证码不能为空", function () {
                                    //TODO:提交
                                });
                                return false;
                            } else {
                                var token = GetQueryString("token");
                                var pass = $("#pwInput").val();
                                var pass1 = $("#qrInput").val();
                                var yzm = $("#verification").val();
                                $.ajax({
                                    type: 'POST',
                                    url: "{:U('/User/updatePass')}",
                                    data: {pass: pass, pass1: pass1, yzm: yzm, token: token},
                                    cache: false,
                                    dataType: 'json',
                                    success: function (data) {
                                        modelConfirm(data.info);
                                        if (data.status == 200) {
                                              setTimeout(function() {
						  location.href = "{:U('/login/login')}";
					},3000);  
                                           
                                        }
                                    },
                                    error: function (err) {
                                        result = false;
                                    }
                                });
                            }
                        })

                    })
                    function GetQueryString(name)
                    {
                        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                        var r = window.location.search.substr(1).match(reg);
                        if (r != null)
                            return  unescape(r[2]);
                        return null;
                    }
    </script>
</body>
</html>